home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / ctype.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  6.1 KB  |  213 lines

  1. /*  ctype.h
  2.  
  3.     Defines the locale aware ctype macros.
  4.  
  5. */
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 9.0
  9.  *
  10.  *      Copyright (c) 1987, 1998 by Borland International
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14. /* $Revision:   9.3  $ */
  15.  
  16. #ifndef __CTYPE_H
  17. #define __CTYPE_H
  18.  
  19. #if !defined(RC_INVOKED)
  20.  
  21. #ifndef ___STDDEF_H
  22. #include <_stddef.h>
  23. #endif
  24.  
  25. #ifdef __cplusplus
  26. namespace std {
  27. #endif /* __cplusplus */
  28.  
  29. #if defined(__STDC__)
  30. #pragma warn -nak
  31. #endif
  32.  
  33. #endif  /* !RC_INVOKED */
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. extern unsigned short _RTLENTRY _EXPDATA _chartype[ 257 ];
  40. extern unsigned char _RTLENTRY  _EXPDATA _lower[ 256 ];
  41. extern unsigned char _RTLENTRY  _EXPDATA _upper[ 256 ];
  42.  
  43. int _RTLENTRY _EXPFUNC isalnum (int __c);
  44. int _RTLENTRY _EXPFUNC isalpha (int __c);
  45. int _RTLENTRY _EXPFUNC iscntrl (int __c);
  46. int _RTLENTRY _EXPFUNC isdigit (int __c);
  47. int _RTLENTRY _EXPFUNC isgraph (int __c);
  48. int _RTLENTRY _EXPFUNC islower (int __c);
  49. int _RTLENTRY _EXPFUNC isprint (int __c);
  50. int _RTLENTRY _EXPFUNC ispunct (int __c);
  51. int _RTLENTRY _EXPFUNC isspace (int __c);
  52. int _RTLENTRY _EXPFUNC isupper (int __c);
  53. int _RTLENTRY _EXPFUNC isxdigit(int __c);
  54. int _RTLENTRY _EXPFUNC isascii (int __c);
  55.  
  56. int _RTLENTRY _EXPFUNC iswalnum (_WINT_T __c);
  57. int _RTLENTRY _EXPFUNC iswalpha (_WINT_T __c);
  58. int _RTLENTRY _EXPFUNC iswcntrl (_WINT_T __c);
  59. int _RTLENTRY _EXPFUNC iswdigit (_WINT_T __c);
  60. int _RTLENTRY _EXPFUNC iswgraph (_WINT_T __c);
  61. int _RTLENTRY _EXPFUNC iswlower (_WINT_T __c);
  62. int _RTLENTRY _EXPFUNC iswprint (_WINT_T __c);
  63. int _RTLENTRY _EXPFUNC iswpunct (_WINT_T __c);
  64. int _RTLENTRY _EXPFUNC iswspace (_WINT_T __c);
  65. int _RTLENTRY _EXPFUNC iswupper (_WINT_T __c);
  66. int _RTLENTRY _EXPFUNC iswxdigit(_WINT_T __c);
  67. int _RTLENTRY _EXPFUNC iswascii (_WINT_T __c);
  68. #ifdef __cplusplus
  69. }
  70. #endif
  71.  
  72. /* character classes */
  73.  
  74. #define _IS_UPP    0x0001           /* upper case */
  75. #define _IS_LOW    0x0002           /* lower case */
  76. #define _IS_DIG    0x0004           /* digit */
  77. #define _IS_SP     0x0008           /* space */
  78. #define _IS_PUN    0x0010           /* punctuation */
  79. #define _IS_CTL    0x0020           /* control */
  80. #define _IS_BLK    0x0040           /* blank */
  81. #define _IS_HEX    0x0080           /* [0..9] or [A-F] or [a-f] */
  82. #define _IS_ALPHA  0x0100
  83.  
  84. #define _IS_ALNUM    (_IS_DIG | _IS_ALPHA)
  85. #define _IS_GRAPH    (_IS_ALNUM | _IS_HEX | _IS_PUN)
  86.  
  87. #ifndef __USELOCALES__
  88.  
  89. /* C locale character classification macros */
  90.  
  91. #define isalnum(c)   (__STD _chartype[ (c)+1 ] & (_IS_ALNUM))
  92. #define isalpha(c)   (__STD _chartype[ (c)+1 ] & (_IS_ALPHA))
  93. #define iscntrl(c)   (__STD _chartype[ (c)+1 ] & (_IS_CTL))
  94. #define isdigit(c)   (__STD _chartype[ (c)+1 ] & (_IS_DIG))
  95. #define isgraph(c)   (__STD _chartype[ (c)+1 ] & (_IS_GRAPH))
  96. #define islower(c)   (__STD _chartype[ (c)+1 ] & (_IS_LOW))
  97. #define isprint(c)   (__STD _chartype[ (c)+1 ] & (_IS_GRAPH | _IS_BLK))
  98. #define ispunct(c)   (__STD _chartype[ (c)+1 ] & (_IS_PUN))
  99. #define isspace(c)   (__STD _chartype[ (c)+1 ] & (_IS_SP))
  100. #define isupper(c)   (__STD _chartype[ (c)+1 ] & (_IS_UPP))
  101. #define isxdigit(c)  (__STD _chartype[ (c)+1 ] & (_IS_HEX))
  102.  
  103. #ifndef _UNICODE
  104. #define iswalnum(c)   (__STD _chartype[ (c)+1 ] & (_IS_ALNUM))
  105. #define iswalpha(c)   (__STD _chartype[ (c)+1 ] & (_IS_ALPHA))
  106. #define iswcntrl(c)   (__STD _chartype[ (c)+1 ] & (_IS_CTL))
  107. #define iswdigit(c)   (__STD _chartype[ (c)+1 ] & (_IS_DIG))
  108. #define iswgraph(c)   (__STD _chartype[ (c)+1 ] & (_IS_GRAPH))
  109. #define iswlower(c)   (__STD _chartype[ (c)+1 ] & (_IS_LOW))
  110. #define iswprint(c)   (__STD _chartype[ (c)+1 ] & (_IS_GRAPH | _IS_BLK))
  111. #define iswpunct(c)   (__STD _chartype[ (c)+1 ] & (_IS_PUN))
  112. #define iswspace(c)   (__STD _chartype[ (c)+1 ] & (_IS_SP))
  113. #define iswupper(c)   (__STD _chartype[ (c)+1 ] & (_IS_UPP))
  114. #define iswxdigit(c)  (__STD _chartype[ (c)+1 ] & (_IS_HEX))
  115.  
  116. #endif /* _UNICODE */
  117.  
  118. #endif /* __USELOCALES__ */
  119.  
  120. #define iswascii(c)  ((unsigned)(c) < 128)
  121. #define isascii(c)  ((unsigned)(c) < 128)
  122. #define toascii(c)  ((c) & 0x7f)
  123.  
  124. #ifdef __cplusplus
  125. extern "C" {
  126. #endif
  127.  
  128. int _RTLENTRY _EXPFUNC tolower(int __ch);
  129. int _RTLENTRY _EXPFUNC _ltolower(int __ch);
  130. int _RTLENTRY _EXPFUNC toupper(int __ch);
  131. int _RTLENTRY _EXPFUNC _ltoupper(int __ch);
  132.  
  133. _WINT_T _RTLENTRY _EXPFUNC towlower(_WINT_T __ch);
  134. _WINT_T _RTLENTRY _EXPFUNC towupper(_WINT_T __ch);
  135. wchar_t _RTLENTRY _EXPFUNC _ltowupper(wchar_t __ch);
  136. wchar_t _RTLENTRY _EXPFUNC _ltowlower(wchar_t __ch);
  137.  
  138. #if !defined(__STDC__)    /* NON-ANSI */
  139. #define _toupper(c) ((c) + 'A' - 'a')
  140. #define _tolower(c) ((c) + 'a' - 'A')
  141. #endif
  142.  
  143.  
  144. #ifdef __cplusplus
  145. }
  146. #endif
  147.  
  148. #if defined( __USELOCALES__ )
  149.  
  150. #define toupper    _ltoupper
  151. #define tolower    _ltolower
  152. #define towupper   _ltowupper
  153. #define towlower   _ltowlower
  154. #define _wcsupr    _lwcsupr
  155. #define _wcslwr    _lwcslwr
  156.  
  157. #endif  /*  __USELOCALES__  */
  158.  
  159. #if !defined(RC_INVOKED)
  160.  
  161. #if defined(__STDC__)
  162. #pragma warn .nak
  163. #endif
  164.  
  165. #ifdef __cplusplus
  166. } // std
  167. #endif /* __cplusplus */
  168.  
  169. #endif  /* !RC_INVOKED */
  170.  
  171. #endif /* __CTYPE_H */
  172.  
  173. #if defined(__cplusplus) && !defined(__USING_CNAME__) && !defined(__CTYPE_H_USING_LIST)
  174. #define __CTYPE_H_USING_LIST
  175.      using std::_chartype;
  176.      using std::_lower;
  177.      using std::_upper;
  178.      using std::isalnum;
  179.      using std::isalpha;
  180.      using std::iscntrl;
  181.      using std::isdigit;
  182.      using std::isgraph;
  183.      using std::islower;
  184.      using std::isprint;
  185.      using std::ispunct;
  186.      using std::isspace;
  187.      using std::isupper;
  188.      using std::isxdigit;
  189.      using std::isascii;
  190. #ifndef _UNICODE
  191.      using std::iswalnum;
  192.      using std::iswalpha;
  193.      using std::iswcntrl;
  194.      using std::iswdigit;
  195.      using std::iswgraph;
  196.      using std::iswlower;
  197.      using std::iswprint;
  198.      using std::iswpunct;
  199.      using std::iswspace;
  200.      using std::iswupper;
  201.      using std::iswxdigit;
  202. #endif
  203.      using std::iswascii;
  204.      using std::tolower;
  205.      using std::_ltolower;
  206.      using std::toupper;
  207.      using std::_ltoupper;
  208.      using std::towlower;
  209.      using std::towupper;
  210.      using std::_ltowupper;
  211.      using std::_ltowlower;
  212. #endif /* __USING_CNAME__ */
  213.